﻿<%@ Page Language="C#" MasterPageFile="~/mpEShop.master" AutoEventWireup="true" CodeFile="ContactUs.aspx.cs"
    Inherits="ContactUs" Title="Contact Us" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script language="javascript" type="text/javascript">
        $('document').ready(function () {

            var hdnCompanyValue = $f("<%=hdnCompany.ClientID%>").value;

            if (hdnCompanyValue != 'undefined') {
                var Company = eval('(' + hdnCompanyValue + ')');
                $f('lblTelephone').innerText = Company.Telephone;
                $f('lblAddress').innerText = Company.Address;
                $f('lblFax').innerText = Company.Fax;
                $f('lblEmail').innerText = Company.Email;

                var MapInfo = new Object();
                MapInfo.Name = Company.Name;
                MapInfo.Address = Company.Address;
                Mapinitialize(MapInfo);
            }

            var hdnCompanyWorkingHour = $f("<%=hdnCompanyWorkingHour.ClientID%>").value;
            if (hdnCompanyWorkingHour != 'undefined') {
                var CompanyWorkingHour = eval('(' + hdnCompanyWorkingHour + ')');

                for (var i = 0; i < CompanyWorkingHour.length; i++) {
                    var fromDate = CompanyWorkingHour[i].FromHour;
                    var toDate = CompanyWorkingHour[i].ToHour;
                    $f("lblWorkingHour_" + CompanyWorkingHour[i].DayOfWeek + "_From").innerText = (fromDate.getHours() + 100).toString().substring(1, 3) + ":" + (fromDate.getMinutes() + 100).toString().substring(1, 3);
                    $f("lblWorkingHour_" + CompanyWorkingHour[i].DayOfWeek + "_To").innerText = (toDate.getHours() + 100).toString().substring(1, 3) + ":" + (toDate.getMinutes() + 100).toString().substring(1, 3);
                }
            }
        })

        function Mapinitialize(MapInfo) {
            var lat = '';
            var lng = '';
            var geocoder = new google.maps.Geocoder();
            geocoder.geocode({ 'address': MapInfo.Address }, function (results, status) {
                if (status == google.maps.GeocoderStatus.OK) {
                    lat = results[0].geometry.location.lat(); //getting the lat
                    lng = results[0].geometry.location.lng(); //getting the lng
                    map.setCenter(results[0].geometry.location);
                    var marker = new google.maps.Marker({
                        map: map,
                        position: results[0].geometry.location
                    });
                } else {
                    alert("Geocode was not successful for the following reason: " + status);
                }
            });

            var latlng = new google.maps.LatLng(lat, lng);
            var settings = {
                zoom: 16,
                center: latlng,
                mapTypeControl: true,
                mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU },
                navigationControl: true,
                navigationControlOptions: { style: google.maps.NavigationControlStyle.SMALL },
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };

            var map = new google.maps.Map(document.getElementById("map_canvas"), settings);

            var contentString = '<div id="content">' +
					'<div id="siteNotice">' +
					'</div>' +
					'<h1 id="firstHeading" style="font-family: tahoma;font-size: 12pt;" >' +
					Isundefined(MapInfo.Name, 'Restuarent')
					+ '</h1>' +
					'<div id="bodyContent">' +
                    Isundefined(MapInfo.Address, '')
            '</div>' +
					'</div>';
            var infowindow = new google.maps.InfoWindow({
                content: contentString
            });




            var companyPos = latlng;

            var companyMarker = new google.maps.Marker({
                position: companyPos,
                map: map,
                title: Isundefined(MapInfo.Name, 'Restuarent'),
                zIndex: 3
            });
            infowindow.open(map, companyMarker);
            google.maps.event.addListener(companyMarker, 'click', function () {
                infowindow.open(map, companyMarker);
            });
        }
    </script>
    <asp:HiddenField ID="hdnCompany" runat="server" />
    <asp:HiddenField ID="hdnCompanyWorkingHour" runat="server" />
    <div class="PageCover" align="center">
        <table width="100%">
            <tr>
                <td style="width: 300px; vertical-align: top">
                    <div align="left">
                        <div class="divContactInformation">
                            <table>
                                <tr class="Row">
                                    <td>
                                        <div class="itemLabel">
                                            Telephone</div>
                                    </td>
                                    <td>
                                        <div class="itemValue">
                                            <label id="lblTelephone">
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="Row">
                                    <td>
                                        <div class="itemLabel">
                                            Address</div>
                                    </td>
                                    <td>
                                        <div class="itemValue">
                                            <label id="lblAddress">
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="Row">
                                    <td>
                                        <div class="itemLabel">
                                            Fax</div>
                                    </td>
                                    <td>
                                        <div class="itemValue">
                                            <label id="lblFax">
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="Row">
                                    <td>
                                        <div class="itemLabel">
                                            Email</div>
                                    </td>
                                    <td>
                                        <div class="itemValue">
                                            <label id="lblEmail">
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div align="left">
                        <div class="divContactInformation">
                            <table>
                                <tr class="Row">
                                    <td>
                                        <div class="itemLabel">
                                            Öffnungzeiten</div>
                                    </td>
                                </tr>
                                <tr class="Row">
                                    <td>
                                        <div class="itemLabel">
                                            Montag</div>
                                    </td>
                                    <td>
                                        <div class="itemValue">
                                            <label id="lblWorkingHour_1_From">
                                            </label>
                                            <span>- </span>
                                            <label id="lblWorkingHour_1_To">
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="Row">
                                    <td>
                                        <div class="itemLabel">
                                            Dienstag</div>
                                    </td>
                                    <td>
                                        <div class="itemValue">
                                            <label id="lblWorkingHour_2_From">
                                            </label>
                                            <span>- </span>
                                            <label id="lblWorkingHour_2_To">
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="Row">
                                    <td>
                                        <div class="itemLabel">
                                            Mittwoch</div>
                                    </td>
                                    <td>
                                        <div class="itemValue">
                                            <label id="lblWorkingHour_3_From">
                                            </label>
                                            <span>- </span>
                                            <label id="lblWorkingHour_3_To">
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="Row">
                                    <td>
                                        <div class="itemLabel">
                                            Donnerstag</div>
                                    </td>
                                    <td>
                                        <div class="itemValue">
                                            <label id="lblWorkingHour_4_From">
                                            </label>
                                            <span>- </span>
                                            <label id="lblWorkingHour_4_To">
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="Row">
                                    <td>
                                        <div class="itemLabel">
                                            Freitag</div>
                                    </td>
                                    <td>
                                        <div class="itemValue">
                                            <label id="lblWorkingHour_5_From">
                                            </label>
                                            <span>- </span>
                                            <label id="lblWorkingHour_5_To">
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="Row">
                                    <td>
                                        <div class="itemLabel">
                                            Samstag</div>
                                    </td>
                                    <td>
                                        <div class="itemValue">
                                            <label id="lblWorkingHour_6_From">
                                            </label>
                                            <span>- </span>
                                            <label id="lblWorkingHour_6_To">
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="Row">
                                    <td>
                                        <div class="itemLabel">
                                            Sonntag</div>
                                    </td>
                                    <td>
                                        <div class="itemValue">
                                            <label id="lblWorkingHour_7_From">
                                            </label>
                                            <span>- </span>
                                            <label id="lblWorkingHour_7_To">
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </td>
                <td style="direction: rtl;">
                    <div id="map_canvas">
                    </div>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
